package com.noble.glamour.ui.user.my.gift;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.noble.glamour.R;
import com.noble.glamour.bean.config.base.Goods;
import com.noble.glamour.third.recyclerholder.BaseRecyclerViewAdapter;
import com.noble.glamour.third.recyclerholder.BaseRecyclerViewHolder;
import com.noble.library.log.PToast;

/**
 * 礼物列表
 */
public class MyGiftAdapter extends BaseRecyclerViewAdapter<Goods> {

    private Context mContext;

    public MyGiftAdapter(Context mContext) {
        this.mContext = mContext;
    }

    @Override
    public int[] getItemLayouts() {
        return new int[]{R.layout.my_gift_item};
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return super.onCreateViewHolder(parent, viewType);
    }

    @Override
    public void onBindRecycleViewHolder(BaseRecyclerViewHolder viewHolder, int position) {

        MyViewHolder vh = new MyViewHolder(viewHolder);
        final Goods info = getItem(position);
        vh.send_name.setText("Rainie");
        vh.gift_info.setText("3天前送你棒棒糖");
        vh.gift_thinks.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                PToast.showShort("答谢");
            }
        });
    }

    @Override
    public int getRecycleViewItemType(int position) {
        return 0;
    }

    class MyViewHolder {
        ImageView gift_icon, send_head;
        TextView send_name, gift_info;
        Button gift_thinks;

        public MyViewHolder(BaseRecyclerViewHolder convertView) {
            initView(convertView);
        }

        private void initView(BaseRecyclerViewHolder convertView) {
            gift_icon = convertView.findViewById(R.id.gift_icon);
            send_head = convertView.findViewById(R.id.send_head);
            send_name = convertView.findViewById(R.id.send_name);
            gift_info = convertView.findViewById(R.id.gift_info);
            gift_thinks = convertView.findViewById(R.id.gift_thinks);
        }
    }
}